package com.briup.app04.web;

import com.briup.app04.bean.Cms_category;
import com.briup.app04.service.ICms_categoryService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = {"栏目接口管理"}, description = "增删查改的实现")
@RestController
@RequestMapping("/cms_category")
public class Cms_categoryController {
    @Autowired
    private ICms_categoryService cms_categoryService;

    @GetMapping("findAll")
    public List<Cms_category> findAll(){

        return cms_categoryService.findAll();
    }

    @GetMapping("save")
    public String save(Cms_category cms_category){
        cms_categoryService.save(cms_category);
        return "保存成功";
    }

    @PostMapping("update")
    public String update(Cms_category cms_category) {
        cms_categoryService.update(cms_category);
        return "更新成功";
    }

    @PostMapping("deleteById")
    public String deleteById(long id) {
        cms_categoryService.deleteById(id);
        return "删除成功";
    }
}
